import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-03-07
 * Time: 13:49
 */
public class Test {
    public static int sumOne(int n) {
        int count = 0;
        while (n != 0) {
            if ((n & 1) == 1) {
                count++;
            }
            n = n>>>1;
        }

        return count;
    }

    public static void main(String[] args) {
        //求一个整数，在内存当中存储时，二进制1的个数。
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(sumOne(n));
    }

    public static void narNumber(int n) {
        for (int i = 1; i <= n; i++) {
            int count = 0;//统计几位数
            int tmp = i;
            while (tmp != 0) {
                count++;
                tmp /= 10;
            }
            tmp = i;
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10, count);
                tmp /= 10;
            }
            if (sum == i) {
                System.out.print(i + " ");
            }
        }
    }

    public static void main9(String[] args) {
        // 求出0～n之间的所有“水仙花数”并输出。(“水仙花数”是指一个三位数，其各位数字的立方和确好等于该数本 身，如；153＝1^3＋5^3＋3^3，则153是一个“水仙花数“。）
        Scanner scanner = new Scanner(System.in);
        narNumber(scanner.nextInt());
    }

    public static void printOne(int n) {
        //输出奇数位
        for (int i = 30; i >= 0; i -= 2) {
            System.out.print(((n >>> i) & 1) + " ");
        }
        System.out.println();
        for (int j = 31; j >= 1; j -= 2) {
            System.out.print(((n >>> j) & 1) + " ");
        }
    }

    public static void main8(String[] args) {
        // 获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
        Scanner scanner = new Scanner(System.in);
        printOne(scanner.nextInt());
    }

    public static void Print(int n) {
        while (n != 0) {
            int tmp = n % 10;
            System.out.printf("%d ", tmp);
            n /= 10;
        }
    }

    public static void main7(String[] args) {
        Print(123);
    }

    /**
     * 编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，提示“登录成功”,密码错误， 可以重新输 入，最多输入三次。三次均错，则提示退出程序
     *
     * @param args
     */

    public static void Login() {
        Scanner scanner = new Scanner(System.in);
        String str = "20020531tc";//标准密码
        int count = 3;
        while (count != 0) {
            System.out.print("请输入密码：");
            String login = scanner.nextLine();
            if (login.equals(str)) {
                System.out.println("密码输入正确,登录成功！");
                break;
            } else {
                count--;
                System.out.println("密码输入错误,你还有" + count + "次登录机会！");
                continue;
            }
        }
    }

    public static void main6(String[] args) {
        Login();
    }

    public static int sumAdd(int n) {

        int ret = 0;
        for (int j = 1; j <= n; j++) {
            int sum = 1;
            for (int i = 1; i <= j; i++) {
                sum *= i;
            }
            ret += sum;
        }
        return ret;
    }

    public static void main5(String[] args) {

        System.out.println(sumAdd(5));
    }

    public static void main4(String[] args) {
        // 输出n*n的乘法口诀表，n由用户输入。
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.printf("%d * %d = %d\t", i, j, i * j);
            }
            System.out.println();
        }
    }

    public static void main3(String[] args) {
        // 求两个数的最大公约数
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = a % b;
        while (c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.printf("最大公约数为:%d", b);
    }

    public static void main2(String[] args) {
        // 计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值 。
        double sum = 0.0;
        int flag = 1;
        for (int i = 1; i <= 100; i++) {
            sum += 1.0 / i * flag;
            flag = -flag;
        }
        System.out.println(sum);
    }

    /**
     * 猜数字小游戏
     *
     * @param args
     */
    public static void main1(String[] args) {
        Random random = new Random();
        int number = random.nextInt(100);// [0-~)
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.print("开始猜数字游戏 (1-100): ");
            int n = scanner.nextInt();
            if (n > number) {
                System.out.println("猜大了");
            } else if (n == number) {
                System.out.println("猜对了");
                break;
            } else {
                System.out.println("猜小了");
            }
        }
    }
}
